<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />

		<title></title>
		<script src="../../js/mui.min.js"></script>
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<script src="../../js/getURLParam.js"></script>
		<link rel="stylesheet" href="../../css/global.css">
		<style>
			html,
			body {
				background-color: #efeff4;
			}
			/*控制a标签样式*/
			a:link {color:#000000}

			a:hover {color:#000000}
			
			a:visited {color:#000000}
			
			a:active {color:#000000}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav headerstyle">
			<a class="mui-action-back astyle"><img src="../../images/drawable-hdpi/head_back.png"/></a>
			<h1 class="mui-title">单车保养记录</h1>
		</header>
        <div class="mui-content" id="mainRecord"></div>
		<script type="text/javascript" charset="utf-8">
			//mui初始化 
			mui.init();
			var sessionid=GetQueryString("sessionid");
	        var accountid=GetQueryString("accountid");
	        var proversion=GetQueryString("proversion");
	        var vclid = GetQueryString("vclid");
			var mainRecord = document.getElementById("mainRecord");
			var mainCont = "无保养记录";
			//ajax请求获取单车保养记录
			mui.ajax('../../../APPIOS/mainRecord', {
				data: {
					param: '{"proVersion":"' + proversion + '","accountId":"' + accountid + '","sessionid":"' + sessionid + '","data":{"vclId":"' + vclid + '"}}'
				},
				dataType: 'jsonp', //服务器返回json格式数据
				type: 'post', //HTTP请求类型
				timeout: 10000, //超时时间设置为10秒；
				success: function(data) {
					var jsonObj = window.JSON.parse(data);
					if (jsonObj.resultcode == "1") {
						//获取返回数据的data
						var resultdata = jsonObj.data;
						if (null != resultdata) {
							//title.innerHTML = vclno+"("+resultdata.orgname+")";
							if(resultdata.mainRemind != null){
								mainremind=true;
							}
							if(resultdata.mrList.length>0){
								mainCont="";
								if(mainremind){
									mainCont+='<p style="background-color: white;text-indent: 0px;margin: 0px;padding: 4px;"><span style="color: red;font-size: 12px;">!'+resultdata.mainRemind+'<button type="button" style="width: 40px;font-size: 11px;" >保养</button></span></p>';
								}
								for(var i=0;i<resultdata.mrList.length;i++){
									mainCont+='<p style="background-color: white;text-indent: 0px;margin: 0px;padding: 4px;">';
									mainCont+='<span style="font-size: 12px;">'+resultdata.mrList[i].worktime+'小时保养'+resultdata.mrList[i].maindate+'</span>';
								}
							}
							mainRecord.innerHTML=mainCont;
						} else {
							mainRecord.innerHTML=mainCont;
						}
			
					} else {
						mainRecord.innerHTML = "请求出错!" + jsonObj.resultcode;
					}
				},
				error: function(xhr, type, errorThrown) {
				}
			});
</script>
	</body>

</html>